<template>
  <div class="index">
    <div class="left">
      <div v-for="(item,index) in list" :key="index" @click="clickBtn(item.val)">{{item.name}}</div>
    </div>
    <div class="right">
      <div id="mount-point"></div>
      <component :is="componentId"></component>
    </div>
  </div>
</template>

<script>
import menu1 from "../components/menu/menu1";
import menu2 from "../components/menu2/menu2";
import menu3 from "../components/menu3/menu3";
import Vue from "vue";
export default {
  data() {
    return {
      list: [
        {
          id: 1,
          name: "菜单一",
          val: "menu1"
        },
        {
          id: 1,
          name: "菜单一",
          val: "menu2"
        },
        {
          id: 2,
          name: "菜单二",
           val: "menu3"
        },
        {
          id: 3,
          name: "菜单三"
        },

        {
          id: 4,
          name: "菜单四"
        },
        {
          id: 5,
          name: "菜单五"
        },
        {
          id: 6,
          name: "菜单六"
        },

        {
          id: 7,
          name: "菜单七"
        },
        {
          id: 8,
          name: "菜单八"
        },

        {
          id: 9,
          name: "菜单九"
        },
        {
          id: 10,
          name: "菜单十"
        },
        {
          id: 11,
          name: "菜单十一"
        }
      ],
      componentId: "menu1"
    };
  },
  methods: {
    clickBtn(val) {
      this.componentId = val;
    }
  },
  created() {

  },
  components: {
    menu1,
    menu2,
    menu3
  }
};
</script>

<style  scoped>
.index {
  display: flex;
  justify-content: flex-start;
  width: 1200px;
  margin: 0 auto;
}
.left {
  width: 20%;
  border: 1px solid #eee;
}
.left div {
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border: 1px solid #eee;
  cursor: pointer;
}
</style>
